"""
利用Python实现一个多线程程序
将多线程程序改为多进程程序
"""
import requests
from threading import Thread
from multiprocessing import Process


def SaoDi(i):
    print("我在扫地",i)

def TuoDi(i):
    print("我在拖地",i)

# # 多线程
# s_list = []
# for i in range(10):
#     # 只是创建了线程对象
#     s = Thread(target=SaoDi,args=(i,))
#     # 启动线程
#     s.start()
#     s_list.append(s)
# for s in s_list:
#     s.join()

# 多进程
if __name__ == "__main__":
    process_array=[]
    for i in range(10):
        p = Process(target=TuoDi,args=(i,))
        process_array.append(p)
        p.start()
    for p in process_array:
        p.join()